﻿<%@ Page Language="C#" AutoEventWireup="true" Codebehind="currentopenprojectlist.aspx.cs"
    Inherits="LabMS.Web.OpenProject.currentopenprojectlist" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>本学期开放项目列表</title>
    <link type="text/css" rel="stylesheet" href="../style/screen.css" />
    <link href="../css/jquery.wysiwyg.css" rel="stylesheet" type="text/css" />
    <!--[if lte IE 6]>
    <link type="text/css" rel="stylesheet" href="../style/ie6.css" />
    <![endif]-->
    <!--[if lte IE 7]>
    <link type="text/css" rel="stylesheet" href="../style/ie7.css" />
    <![endif]-->
    <script src="../js/Common.js" type="text/javascript"></script>
</head>
<body class="mainBody">
    <form id="form1" runat="server">
        <div class="main">
            <div id="pageInfo" class="clearfix">
                <div class="title">
                    <label>
                        本学期开放项目列表</label>
                </div>
            </div>
        </div>
        <div class="main">
            <p>
                <%--<asp:CheckBox ID="checkall" CssClass="checkbox" runat="server" Font-Size="9pt" Text="全选" />--%>
                 <% if (UserType != "mana")
                  {%>
                  <input id="tbnAdd" type="button" class="button" value="新增申请" onclick="javascript:window.location.href='addopenproject.aspx'" />
                  <%} %>
                <asp:Button ID="btDel" CssClass="button" Enabled="false" runat="server" Text="删除"
                    OnClick="btDel_Click" />
            </p>
            <p>
                <label>
                    实验室:</label>
                <asp:DropDownList ID="ddlLab" runat="server">
                </asp:DropDownList>
                <label>
                    状态:</label>
                <asp:DropDownList ID="ddlStatus" runat="server">
                    <asp:ListItem Text="" Value="-1"></asp:ListItem>
                    <asp:ListItem Text="未申请" Value="0"></asp:ListItem>
                    <asp:ListItem Text="审核中" Value="1"></asp:ListItem>
                    <asp:ListItem Text="已批准(不通过)" Value="2"></asp:ListItem>
                    <asp:ListItem Text="已批准(通过)" Value="3"></asp:ListItem>
                </asp:DropDownList>
                <label>
                    实验名称:</label>
                <asp:TextBox ID="tbProjectName" runat="server"></asp:TextBox>
                <asp:Button ID="btnSearch" runat="server" Text="搜索" OnClick="btnSearch_Click" CssClass="button" />
                <asp:Button ID="btnRest" runat="server" Text="重置" OnClick="btnRest_Click" CssClass="button" />
            </p>
        </div>
        <div class="main">
            <asp:GridView ID="gv_OpenProjectList" runat="server" Width="100%" PageSize="15" AllowPaging="true"
                DataKeyNames="ID,OP_ProjectCode" AutoGenerateColumns="False" OnRowDataBound="GridViewConsum_RowDataBound"
                OnPageIndexChanging="GridViewConsum_PageIndexChanging" CssClass="infoTable">
                <Columns>
                    <asp:TemplateField ItemStyle-CssClass="checkBox">
                        <HeaderTemplate>
                            <asp:CheckBox ID="CBAll" runat="server" />
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:CheckBox runat="server" ID="checkdel" /></ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField DataField="OP_ProjectName" HeaderText="实验名称" />
                    <asp:BoundField DataField="OP_Teacher" HeaderText="指导老师" />
                    <asp:BoundField DataField="Project_Lab" HeaderText="实验室" />
                    <asp:BoundField DataField="OP_PlanningCourseTime" HeaderText="学时" />
                    <asp:BoundField DataField="Project_Require" HeaderText="要求" />
                    <asp:BoundField DataField="OP_OpenType" HeaderText="学生数量" />
                    <asp:BoundField DataField="OP_Phone" HeaderText="起-止(周)" />
                    <asp:BoundField DataField="Project_Type" HeaderText="实验类型" />
                    <asp:BoundField DataField="OP_Audit" HeaderText="状态" HtmlEncode="false" />
                </Columns>
                <HeaderStyle CssClass="header" />
                <RowStyle HorizontalAlign="Center" />
                <EmptyDataTemplate>
                    <a style="color: Red">无数据</a>
                </EmptyDataTemplate>
            </asp:GridView>
            <asp:Label ID="lbErr" runat="server" ForeColor="Red" Text="Err" Visible="False"></asp:Label>
            <asp:Label ID="lbIsSearch" runat="server" Text="0" Visible="False"></asp:Label>
        </div>
    </form>

    <script type="text/javascript" src="../js/Common.js"></script>

    <script type="text/javascript" src="../js/jQuery/jquery-1.3.1.js"></script>

    <script type="text/javascript" src="../js/site.js"></script>

    <script type="text/javascript">

        $(function(){
            /* 修改样式 */
            $("#gv_OpenProjectList > tbody > tr:even").not(":first").addClass("even");
            $("#gv_OpenProjectList > tbody > tr").not(":first")
                .hover(
                    function(){
                        $(this).addClass("hover");
                    },
                    function(){
                        $(this).removeClass("hover");
                });

            /* 全选 */
            $("#gv_OpenProjectList > tbody > tr:first :checkbox").click(function(){
                if ($(this).attr("checked")){
                    $("#gv_OpenProjectList :checkbox").attr("checked", "checked");
                    cbChanged();
                } else{
                    $("#gv_OpenProjectList :checkbox").attr("checked", "");
                    cbChanged();
                }
            });

            /* Checkbox事件 */
            $("#gv_OpenProjectList :checkbox").not(":first").click(cbChanged);

            cbChanged();
        });

        /* 检测Checkbox的选择状态，更改button的disabled属性 */
        function cbChanged(){
            var hasChecked = false;
            var allChecked = true;
            $("#gv_OpenProjectList :checkbox").not(":first").each(function(index, domEle){
                var curChecked = $(domEle).attr("checked");
                if (!hasChecked && curChecked){
                    hasChecked = true;
                }

                allChecked &= curChecked;
            });

            if (hasChecked){
                $("#btDel").attr("disabled", "");
            } else {
                $("#btDel").attr("disabled", "disabled");
            }

            if (allChecked){
                $("#gv_OpenProjectList :checkbox").filter(":first").attr("checked", "checked");
            } else {
                $("#gv_OpenProjectList :checkbox").filter(":first").attr("checked", "");
            }
        }
    </script>

</body>
</html>
